#include <iostream>
#include <stack>
#include <string>

using namespace std;

int main(){
    stack<char> st;
    string s;
    bool fl=true;
    cout<<"Please enter the bracket sequence: ";
    cin >> s;
    if (s.length()%2==0){
        for(int i=0;i<s.length();i++)
        {  
            if(s[i] == '('||s[i]=='['||s[i]=='{'||s[i]=='<')
                st.push(s[i]);
            else{
                if((st.empty()) || (s[i] == ')' && st.top() != '(') || (s[i] == ']' && st.top() != '[') || (
                    s[i] == '}' && st.top() != '{') || (s[i] == '>' && st.top() != '<')){
                        cout<<"False";
                        fl = false;
                        break;
                    }
            st.pop();
            }
        }
        if (fl==true && st.empty())
            cout<<"True";
    }
    else
        cout<<"False";
    return 0;
}